package com.sky.service.impl;

import com.sky.entity.DishFlavor;
import com.sky.mapper.DishFlavorMapper;
import com.sky.service.DishFlavorService;
import com.sky.service.DishService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author ttao
 * @since 2023/4/24 16:53
 */

@Service
public class DishFlavorServiceImpl implements DishFlavorService {

    @Autowired
    private DishFlavorMapper dishFlavorMapper;

    /**
     * 向菜品口味关系表 批量插入口味数据
     *
     * @param dishFlavorList
     * @return
     */
    @Override
    public int insertBatch(List<DishFlavor> dishFlavorList) {
        return dishFlavorMapper.insertBatch(dishFlavorList);
    }

    /**
     * 根据菜品id删除关联的口味数据
     *
     * @param dishIds
     * @return
     */
    @Override
    public int deleteByDishIds(List<Long> dishIds) {
        return dishFlavorMapper.deleteByDishIds(dishIds);
    }

    /**
     * 根据id查询菜品关联的口味
     *
     * @param id
     * @return
     */
    @Override
    public List<DishFlavor> selectByDishId(Long id) {
        return dishFlavorMapper.selectByDishId(id);
    }
}
